/**
 * @file main.cpp
 * @author yangx (yangxing2297@163.com)
 * @brief 测试客户端代码
 * @version 0.1
 * @date 2023-04-09
 * 
 * @copyright Copyright (c) 2023
 * 
 */
#include <iostream>
#include "TcpClient.h"
#include "TcpClientImpl.h"

void CReadMsg(char *const msg, uint32_t len)
{
    std::cout << "Msg: " << msg << std::endl;
}

void CStatus(ClientStatus status)
{
    switch (status)
    {
    case Connected:
        std::cout << "Connected" << std::endl;
        break;
    case Closed:
        std::cout << "Closed" << std::endl;
        break;
    case Timeout:
        std::cout << "Timeout" << std::endl;
        break;
    case ReadEof:
        std::cout << "ReadEof" << std::endl;
        break;
    case Error:
        std::cout << "Error" << std::endl;
        break;
    default:
        break;
    }
}



int main(int argc, char const *argv[])
{
    CTcpClient *tcpClient = new CTcpClientImpl(CReadMsg, CStatus);
    tcpClient->Connect("172.22.5.240", 8081, 5);
    // tcpClient->Connect("127.0.0.1", 8081);
    tcpClient->Run();

    return 0;
}
